\hypertarget{menu_8c}{
\section{front\_\-panel/menu.c File Reference}
\label{menu_8c}\index{front\_\-panel/menu.c@{front\_\-panel/menu.c}}
}
Menu system.  


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include $<$avr/interrupt.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}menu.h\char`\"{}}\par
{\tt \#include \char`\"{}board.h\char`\"{}}\par
{\tt \#include \char`\"{}glcd.h\char`\"{}}\par
{\tt \#include \char`\"{}fonts.h\char`\"{}}\par
{\tt \#include \char`\"{}display.h\char`\"{}}\par
{\tt \#include \char`\"{}radio\_\-interface.h\char`\"{}}\par
{\tt \#include \char`\"{}errors.h\char`\"{}}\par
{\tt \#include \char`\"{}event\_\-handler.h\char`\"{}}\par
{\tt \#include \char`\"{}led\_\-control.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{menu_8c_e3ace71c08f95934c9771641f0603e8e}{
\#define \hyperlink{menu_8c_e3ace71c08f95934c9771641f0603e8e}{MENU\_\-OPTION\_\-LEFT\_\-POS}~13}
\label{menu_8c_e3ace71c08f95934c9771641f0603e8e}

\begin{CompactList}\small\item\em Sets the intend from the left. \item\end{CompactList}\item 
\hypertarget{menu_8c_508c36d9f15f466ef2d0d92626df3655}{
\#define \hyperlink{menu_8c_508c36d9f15f466ef2d0d92626df3655}{MENU\_\-OPTIONS}~7}
\label{menu_8c_508c36d9f15f466ef2d0d92626df3655}

\begin{CompactList}\small\item\em Number of options in the menu system. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{menu_8c_4b4c949d733bb56771f8195984a90037}{menu\_\-show\_\-text} (\hyperlink{structstruct__menu__text}{struct\_\-menu\_\-text} menu\_\-text)
\begin{CompactList}\small\item\em Show the text of a menu on the display. \item\end{CompactList}\item 
\hypertarget{menu_8c_06928afa5c7f6b2572306f21cd7d2d31}{
void \hyperlink{menu_8c_06928afa5c7f6b2572306f21cd7d2d31}{menu\_\-init} (void)}
\label{menu_8c_06928afa5c7f6b2572306f21cd7d2d31}

\begin{CompactList}\small\item\em Initialize the menu system. \item\end{CompactList}\item 
\hypertarget{menu_8c_214b6d30aba6a9bd92470ca0047d524c}{
void \hyperlink{menu_8c_214b6d30aba6a9bd92470ca0047d524c}{menu\_\-reset} (void)}
\label{menu_8c_214b6d30aba6a9bd92470ca0047d524c}

\begin{CompactList}\small\item\em Function will reset to init values, like menu level etc. \item\end{CompactList}\item 
\hypertarget{menu_8c_82d0bc5ed88880b96974496b879fa22b}{
void \hyperlink{menu_8c_82d0bc5ed88880b96974496b879fa22b}{menu\_\-show} (void)}
\label{menu_8c_82d0bc5ed88880b96974496b879fa22b}

\begin{CompactList}\small\item\em Shows the menu. \item\end{CompactList}\item 
void \hyperlink{menu_8c_ab3a4e9c95a954ba8155fd54eaeda6f4}{menu\_\-action} (unsigned char menu\_\-action\_\-type)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{menu_8c_a566b71ef4547c07dd73d3230649d594}{
const \hyperlink{structstruct__menu__option}{struct\_\-menu\_\-option} \hyperlink{menu_8c_a566b71ef4547c07dd73d3230649d594}{menu\_\-errors} \mbox{[}$\,$\mbox{]} = \{\{\char`\"{}Bus resend\char`\"{}\},\{\char`\"{}No bus sync\char`\"{}\}, \{\char`\"{}Bus TX queue full\char`\"{}\}, \{\char`\"{}Bus RX queue full\char`\"{}\}, \{\char`\"{}Int. comm resend\char`\"{}\}\}}
\label{menu_8c_a566b71ef4547c07dd73d3230649d594}

\begin{CompactList}\small\item\em Menu options - Errors. \item\end{CompactList}\item 
\hypertarget{menu_8c_82f477cebe143b8a016a8cc0e7660d75}{
const \hyperlink{structstruct__menu__option}{struct\_\-menu\_\-option} \textbf{menu\_\-misc} \mbox{[}$\,$\mbox{]} = \{\{\char`\"{}Reboot\char`\"{}\}\}}
\label{menu_8c_82f477cebe143b8a016a8cc0e7660d75}

\item 
\hypertarget{menu_8c_29c756d8e2639ecbcfcda6ea3d7128bd}{
unsigned char \hyperlink{menu_8c_29c756d8e2639ecbcfcda6ea3d7128bd}{current\_\-menu\_\-option\_\-selected} \mbox{[}MENU\_\-OPTIONS\mbox{]}}
\label{menu_8c_29c756d8e2639ecbcfcda6ea3d7128bd}

\begin{CompactList}\small\item\em The current selected menu option. \item\end{CompactList}\item 
\hypertarget{menu_8c_4474e6d28891b829c42414832e4b5805}{
unsigned char \hyperlink{menu_8c_4474e6d28891b829c42414832e4b5805}{current\_\-menu\_\-level} = 0}
\label{menu_8c_4474e6d28891b829c42414832e4b5805}

\begin{CompactList}\small\item\em Flag to indicate which menu level we are on. \item\end{CompactList}\item 
\hypertarget{menu_8c_0e62084779b077b0eb52e03b983e8e30}{
unsigned char \hyperlink{menu_8c_0e62084779b077b0eb52e03b983e8e30}{current\_\-menu\_\-pos} = 0}
\label{menu_8c_0e62084779b077b0eb52e03b983e8e30}

\begin{CompactList}\small\item\em Flag to indicate the current menu position. \item\end{CompactList}\item 
\hypertarget{menu_8c_4ad11c0b67647f67e60c007283ce0e91}{
const \hyperlink{structstruct__menu__option}{struct\_\-menu\_\-option} \hyperlink{menu_8c_4ad11c0b67647f67e60c007283ce0e91}{menu\_\-option\_\-band\_\-selection\_\-mode} \mbox{[}$\,$\mbox{]} = \{\{\char`\"{}Manual\char`\"{}\},\{\char`\"{}Auto\char`\"{}\}\}}
\label{menu_8c_4ad11c0b67647f67e60c007283ce0e91}

\begin{CompactList}\small\item\em Menu system option - band selection mode. \item\end{CompactList}\item 
\hypertarget{menu_8c_f110f5bde7046154178180a4e545a2da}{
const \hyperlink{structstruct__menu__option}{struct\_\-menu\_\-option} \hyperlink{menu_8c_f110f5bde7046154178180a4e545a2da}{menu\_\-option\_\-amp\_\-ptt\_\-output} \mbox{[}$\,$\mbox{]} = \{\{\char`\"{}ON\char`\"{}\},\{\char`\"{}OFF\char`\"{}\}\}}
\label{menu_8c_f110f5bde7046154178180a4e545a2da}

\begin{CompactList}\small\item\em Menu system option - amp ptt output. \item\end{CompactList}\item 
\hypertarget{menu_8c_fd9bb0990d8a8aa7848a3b90ce44ef7e}{
const \hyperlink{structstruct__menu__option}{struct\_\-menu\_\-option} \hyperlink{menu_8c_fd9bb0990d8a8aa7848a3b90ce44ef7e}{menu\_\-option\_\-radio\_\-ptt\_\-output} \mbox{[}$\,$\mbox{]} = \{\{\char`\"{}ON\char`\"{}\},\{\char`\"{}OFF\char`\"{}\}\}}
\label{menu_8c_fd9bb0990d8a8aa7848a3b90ce44ef7e}

\begin{CompactList}\small\item\em Menu system option - radio ptt output. \item\end{CompactList}\item 
const \hyperlink{structstruct__menu__text}{struct\_\-menu\_\-text} \hyperlink{menu_8c_976a437d513dac32467de0432f66e081}{menu\_\-system\_\-text} \mbox{[}$\,$\mbox{]}
\begin{CompactList}\small\item\em Menu system. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Menu system. 

\begin{Desc}
\item[Author:]Mikael Larsmark, SM2WMV \end{Desc}
\begin{Desc}
\item[Date:]2010-01-25 

\begin{Code}\begin{verbatim} #include "front_panel/menu.c " 
\end{verbatim}
\end{Code}

 \end{Desc}


Definition in file \hyperlink{menu_8c-source}{menu.c}.

\subsection{Function Documentation}
\hypertarget{menu_8c_ab3a4e9c95a954ba8155fd54eaeda6f4}{
\index{menu.c@{menu.c}!menu\_\-action@{menu\_\-action}}
\index{menu\_\-action@{menu\_\-action}!menu.c@{menu.c}}
\subsubsection[{menu\_\-action}]{\setlength{\rightskip}{0pt plus 5cm}void menu\_\-action (unsigned char {\em menu\_\-action\_\-type})}}
\label{menu_8c_ab3a4e9c95a954ba8155fd54eaeda6f4}


This function will handle an menu action \char`\"{}event\char`\"{} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em menu\_\-action\_\-type}]Which action did occur? \end{description}
\end{Desc}


Definition at line 173 of file menu.c.

References struct\_\-runtime\_\-settings::amplifier\_\-ptt\_\-output, struct\_\-runtime\_\-settings::band\_\-change\_\-mode, BAND\_\-CHANGE\_\-MODE\_\-AUTO, BAND\_\-CHANGE\_\-MODE\_\-MANUAL, bootloader\_\-start, current\_\-menu\_\-level, current\_\-menu\_\-option\_\-selected, current\_\-menu\_\-pos, display\_\-set\_\-backlight(), event\_\-get\_\-errors(), event\_\-set\_\-error(), KNOB\_\-FUNCTION\_\-AUTO, struct\_\-runtime\_\-settings::lcd\_\-backlight\_\-value, led\_\-set\_\-error(), LED\_\-STATE\_\-OFF, MENU\_\-BUTTON\_\-PRESSED, MENU\_\-OPTION\_\-TYPE\_\-NORMAL, MENU\_\-OPTION\_\-TYPE\_\-SCROLL\_\-NUMBERS, MENU\_\-OPTIONS, MENU\_\-POS\_\-AMP\_\-PTT, MENU\_\-POS\_\-BACKLIGHT\_\-LEVEL, MENU\_\-POS\_\-BAND\_\-MODE, MENU\_\-POS\_\-MISC, MENU\_\-POS\_\-RADIO\_\-PTT, MENU\_\-POS\_\-SHOW\_\-ERRORS, MENU\_\-SCROLL\_\-DOWN, MENU\_\-SCROLL\_\-UP, menu\_\-show(), NR\_\-OF\_\-ERRORS, struct\_\-runtime\_\-settings::radio\_\-ptt\_\-output, runtime\_\-settings, and set\_\-knob\_\-function().

Referenced by event\_\-poll\_\-buttons(), event\_\-pulse\_\-sensor\_\-down(), and event\_\-pulse\_\-sensor\_\-up().\hypertarget{menu_8c_4b4c949d733bb56771f8195984a90037}{
\index{menu.c@{menu.c}!menu\_\-show\_\-text@{menu\_\-show\_\-text}}
\index{menu\_\-show\_\-text@{menu\_\-show\_\-text}!menu.c@{menu.c}}
\subsubsection[{menu\_\-show\_\-text}]{\setlength{\rightskip}{0pt plus 5cm}void menu\_\-show\_\-text ({\bf struct\_\-menu\_\-text} {\em menu\_\-text})}}
\label{menu_8c_4b4c949d733bb56771f8195984a90037}


Show the text of a menu on the display. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em menu\_\-text}]The menu which we wish to show \end{description}
\end{Desc}


Definition at line 79 of file menu.c.

References current\_\-menu\_\-level, current\_\-menu\_\-option\_\-selected, current\_\-menu\_\-pos, display\_\-calculate\_\-width(), event\_\-get\_\-errors(), glcd\_\-line(), struct\_\-menu\_\-text::header, struct\_\-runtime\_\-settings::lcd\_\-backlight\_\-value, MENU\_\-OPTION\_\-LEFT\_\-POS, MENU\_\-OPTION\_\-TYPE\_\-NORMAL, MENU\_\-OPTION\_\-TYPE\_\-SCROLL\_\-NUMBERS, MENU\_\-POS\_\-BACKLIGHT\_\-LEVEL, MENU\_\-POS\_\-SHOW\_\-ACTIVITY, MENU\_\-POS\_\-SHOW\_\-ERRORS, NR\_\-OF\_\-ERRORS, struct\_\-menu\_\-text::option\_\-count, struct\_\-menu\_\-text::option\_\-type, struct\_\-menu\_\-text::options, struct\_\-menu\_\-text::pos, runtime\_\-settings, and struct\_\-menu\_\-option::text.

Referenced by menu\_\-show().

\subsection{Variable Documentation}
\hypertarget{menu_8c_976a437d513dac32467de0432f66e081}{
\index{menu.c@{menu.c}!menu\_\-system\_\-text@{menu\_\-system\_\-text}}
\index{menu\_\-system\_\-text@{menu\_\-system\_\-text}!menu.c@{menu.c}}
\subsubsection[{menu\_\-system\_\-text}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf struct\_\-menu\_\-text} {\bf menu\_\-system\_\-text}\mbox{[}$\,$\mbox{]}}}
\label{menu_8c_976a437d513dac32467de0432f66e081}


\textbf{Initial value:}

\begin{Code}\begin{verbatim} {
{MENU_POS_BAND_MODE, "Band change", (struct_menu_option *)menu_option_band_selection_mode, 2,MENU_OPTION_TYPE_NORMAL},
{MENU_POS_RADIO_PTT, "Radio PTT", (struct_menu_option *)menu_option_radio_ptt_output, 2,MENU_OPTION_TYPE_NORMAL},
{MENU_POS_AMP_PTT, "Amplifier PTT", (struct_menu_option *)menu_option_amp_ptt_output, 2,MENU_OPTION_TYPE_NORMAL},
{MENU_POS_BACKLIGHT_LEVEL, "Backlight", NULL, 0,MENU_OPTION_TYPE_SCROLL_NUMBERS},
{MENU_POS_SHOW_ACTIVITY, "Network activity", NULL, 0,MENU_OPTION_TYPE_NONE},
{MENU_POS_MISC, "Miscellaneous", (struct_menu_option *)menu_misc, 1,MENU_OPTION_TYPE_NORMAL},
{MENU_POS_SHOW_ERRORS, "Errors", (struct_menu_option *)menu_errors, 0,MENU_OPTION_TYPE_NORMAL},
}
\end{verbatim}
\end{Code}
Menu system. 



Definition at line 67 of file menu.c.